package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Svgaqvcf type
*/
@SuppressWarnings("ALL")
public class Svgaqvcf {


        private static volatile Svgaqvcf instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Svgaqvcf getInstance() {
            if (instance == null) {
                synchronized (Svgaqvcf.class) {
                    if (instance == null) {
                        instance = new Svgaqvcf();
                    }
                }
            }
            return instance;
        }


        private Svgaqvcf() {

        }



    public  Boolean judgeVlctaewpsg(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeOpruomdcyl(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeKnnemkxgqc(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeGhnordmdxm(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeTymzbyrmbi(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeHiifswxpre(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeFzcwkazsbn(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeZuwykangfn(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  vlctaewpsg;
    private String  opruomdcyl;
    private String  knnemkxgqc;
    private String  ghnordmdxm;
    private String  tymzbyrmbi;
    private String  hiifswxpre;
    private String  fzcwkazsbn;
    private String  zuwykangfn;


    public void setVlctaewpsg(String vlctaewpsg){
    this.vlctaewpsg = vlctaewpsg;
    }

    public String getVlctaewpsg(){
    return this.vlctaewpsg;
    }
    public void setOpruomdcyl(String opruomdcyl){
    this.opruomdcyl = opruomdcyl;
    }

    public String getOpruomdcyl(){
    return this.opruomdcyl;
    }
    public void setKnnemkxgqc(String knnemkxgqc){
    this.knnemkxgqc = knnemkxgqc;
    }

    public String getKnnemkxgqc(){
    return this.knnemkxgqc;
    }
    public void setGhnordmdxm(String ghnordmdxm){
    this.ghnordmdxm = ghnordmdxm;
    }

    public String getGhnordmdxm(){
    return this.ghnordmdxm;
    }
    public void setTymzbyrmbi(String tymzbyrmbi){
    this.tymzbyrmbi = tymzbyrmbi;
    }

    public String getTymzbyrmbi(){
    return this.tymzbyrmbi;
    }
    public void setHiifswxpre(String hiifswxpre){
    this.hiifswxpre = hiifswxpre;
    }

    public String getHiifswxpre(){
    return this.hiifswxpre;
    }
    public void setFzcwkazsbn(String fzcwkazsbn){
    this.fzcwkazsbn = fzcwkazsbn;
    }

    public String getFzcwkazsbn(){
    return this.fzcwkazsbn;
    }
    public void setZuwykangfn(String zuwykangfn){
    this.zuwykangfn = zuwykangfn;
    }

    public String getZuwykangfn(){
    return this.zuwykangfn;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}